KERNELDIR := /home/ignite/imx6ull/build_image/build
CURRENT_PATH := $(shell pwd)
ARCH = arm
CROSS_COMPILE = arm-linux-gnueabihf-
export ARCH CROSS_COMPILE

# 设置模块名
obj-m := i2c_client_exp.o

# 提取模块名（去掉.o后缀）
MODULE_NAME := $(basename $(notdir $(obj-m)))

all:
	$(MAKE) -C $(KERNELDIR) M=$(CURRENT_PATH) modules

.PHONY: clean clean_no_use

clean:
	$(MAKE) -C $(KERNELDIR) M=$(CURRENT_PATH) clean

clean_no_use:
	find $(CURRENT_PATH) -type f ! -name '$(MODULE_NAME).c' \
	! -name '$(MODULE_NAME).o' ! -name '$(MODULE_NAME).ko' \
	! -name 'Makefile' -delete
